package net.pws.common.security.spi.resource;

/**
 * The cached resource interface to get the resource by specified parameter.
 */
public interface ICachedResource {
    
    /**
     * @return the root resources
     */
    public IResource[] getResources();
    
    /**
     * @return the root resources
     */
    public IResource[] getResources(boolean allowed);
    
    /**
     * @return the root resources
     */
    public IResource[] getResources(String type);
     
    /**
     * @return the root resources
     */
    public IResource[] getResources(String type, boolean allowed);
    
    /**
     * @return the resource by specified id
     */
    public IResource getResource(String resourceId);
    
    /**
     * @param resourceId
     * @return the children of specified resource
     */
    public IResource[] getResourceChildren(String resourceId);
    
    /**
     * @param resourceId
     * @return the children of specified resource
     */
    public IResource[] getResourceChildren(String resourceId, boolean allowed);
    
    /**
     * @param resourceId
     * @param type
     * @return
     */
    public IResource[] getResourceChildren(String resourceId, String type);
    
    /**
     * @param resourceId
     * @param type
     * @return
     */
    public IResource[] getResourceChildren(String resourceId,
                                           String type,
                                           boolean allowed);
    
    /**
     * @param url
     * @return true if the URL is allowed to access
     */
    public boolean allowedUrl(String url);
    
    /**
     * @param url
     * @return true if the URL is forbidden to access
     */
    public boolean forbiddenUrl(String url);
    
    /**
     * @param resourceId
     * @return true if the URL is allowed to access
     */
    public boolean allowedResource(String resourceId);
    
    /**
     * @param resourceId
     * @return true if the URL is forbidden to access
     */
    public boolean forbiddenResource(String resourceId);
    
}
